package com.briup.cms.dao;

import com.briup.cms.bean.Privilege;

import org.apache.ibatis.annotations.*;

import java.util.List;

public interface PrivilegeMapper {

    @Results(value = {
            @Result(column = "is_hidden",property = "isHidden"),
            @Result(column = "parent_id",property = "parentId")
    })

    @Select("select * from cms_privilege")
    List<Privilege> selectAll();

    @Insert("insert into cms_privilege values(null,#{name},#{icon},#{type},#{path},#{isHidden}," +
            "#{introduce},#{parentId})")
    void insert(Privilege privilege);

    @Update("update cms_privilege set name=#{name},icon=#{icon},type=#{type},path=#{path}," +
            "is_hidden=#{isHidden},introduce=#{introduce},parent_id=#{parentId} where id=#{id}")
    void update(Privilege privilege);

    @Delete("delete from cms_privilege where id=#{id}")
    void deleteById(Long id);
}
